home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / bptree.zip / BPMEM.C < prev    next >
Text File  |  1992-09-04  |  1KB  |  37 lines

  1. /----------------------------------------------------------------
  2. // BPMEM.C
  3. //
  4. // BPlus Tree memory allocation functions
  5. //
  6. //---------------------------------------------------------------
  7.  
  8. #include <windows.h>
  9. #include "bptree.h"
  10.  
  11. //---------------------------------------------------------------
  12. // Entry point for Windows DLL
  13. //---------------------------------------------------------------
  14.  
  15. int FAR PASCAL LibMain(  HANDLE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR lpszCmdLine ) {
  16.    if ( wHeapSize > 0 )
  17.       UnlockData( 0 );
  18.    return( 1 );
  19. }
  20.  
  21. //--------------------------------------------------------------
  22. // Memory allocation function implementations for Windows
  23. //--------------------------------------------------------------
  24.  
  25. void FAR * FAR Malloc( DWORD bytes ) {
  26.    return GlobalLock( GlobalAlloc( GHND, bytes ) );
  27. }
  28.    
  29. void FAR Free( void FAR *memory ) {
  30.    GLOBALHANDLE hMemory;
  31.    if( memory == NULL )
  32.       return;
  33.    hMemory = (GLOBALHANDLE)GlobalHandle( (UINT)SELECTOROF( memory ) );
  34.    GlobalUnlock( hMemory );
  35.    GlobalFree( hMemory );
  36. }
  37.